********************************************************************************
* Crisis and the Trajectory of Science: Evidence from the 2014 Ebola Outbreak									   
*																			   *
* Caroline Fry							   *
*																			   *
* This script replicates the figures	contained in the article published in:     *
* Review of Economics and Statistics									   *
********************************************************************************

********************************************************************************
*                                Preliminaries                                 *
********************************************************************************

clear all

set matsize 11000

* Set path:
* global dir "PATH"
* cd "$dir"

capture log close




********************************************************************************
*                                    Figure 1                             *
********************************************************************************

clear 
use ebola.dataset.dta  

*** Panel 1b

preserve
collapse (mean) ebolapubs, by(endemiccountry year)
reshape wide ebolapubs, i(year) j(endemiccountry)
graph bar ebolapubs1 ebolapubs0, over(year) stack ///
bar(1,bcolor(black*1.75)) bar(2,bcolor(gray*0.5)) ///
legend(order(1 "Endemic country" 2 "Non-endemic country")) ytitle(Mean number of ebola pubs per scientist) yscale(r(0 0.8)) plotregion(fcolor(white)) graphregion(fcolor(white))
restore

*** Panel 1c
preserve
gen tempcat = 0 
replace tempcat = 1 if endemiccountry == 1 & dummyntdpubpre == 0
replace tempcat = 2 if endemiccountry == 1 & dummyntdpubpre == 1

collapse (mean) ebolapubs, by(year tempcat)
twoway (line ebolapubs year if tempcat==2, lwidth(.5)) (line ebolapubs year if tempcat==1 , lwidth(.5))  (line ebolapubs year if tempcat == 0 , lwidth(.5) fcolor(black)) ,  xline(2014,lp(shortdash)) xla(2010 2011 2012 2013 2014 "Ebola" 2015 2016 2017 2018 2019) ytitle(Mean number of Ebola pubs per scientist) legend(lab(1 "Endemic country, NTD experience")lab(2 "Endemic country, no NTD experience") lab(3 "Non-endemic country") )   legend(position(6) rows(3))  graphregion(fcolor(white))
restore 

*** Panel 1d

preserve
gen tempcat = 0 
replace tempcat = 1 if endemiccountry == 1 & dummyntdpubpre == 0
replace tempcat = 2 if endemiccountry == 1 & dummyntdpubpre == 1

collapse (mean) nonebolapubs, by(year tempcat)
twoway (line nonebolapubs year if tempcat==2, lwidth(.5)) (line nonebolapubs year if tempcat==1 , lwidth(.5))  (line nonebolapubs year if tempcat == 0 , lwidth(.5)) ,  xline(2014,lp(shortdash)) xla(2010 2011 2012 2013 2014 "Ebola" 2015 2016 2017 2018 2019) ytitle(Mean number of Non-Ebola pubs per scientist) legend(lab(1 "Endemic country, NTD experience")lab(2 "Endemic country, no NTD experience") lab(3 "Non-endemic country") ) legend(position(6) rows(3))  graphregion(fcolor(white))
restore 

